﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="VacationAdd.aspx.cs" Inherits="Web.VacationAdd" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>请假申请 添加</title>
    <base target="_self" />
    <meta content="ie=7" http-equiv="x-ua-compatible">
    <META HTTP-EQUIV="Pragma" CONTENT="no-cache">
    <META HTTP-EQUIV="Cache-Control" CONTENT="no-cache">
    <META HTTP-EQUIV="Expires" CONTENT="0">
    <link href="Styles/Style01.css" rel="stylesheet" type="text/css" />
    <script src="Scripts/jquery-1.7.min.js" type="text/javascript"></script>
    <link href="Styles/validate.css" rel="stylesheet" type="text/css" />
    <script src="Scripts/easy_validator.pack.js" type="text/javascript"></script>
    <script>
        $(function () {
            $("[reg]").parents("td").prev().append("<font color='#ff0000'>*</font>");
            $("#btnSave").click(function () {
                var isSubmit = true;
                $("form").find("[reg],[url]:not([reg])").each(function () {
                    if (!validate($(this), this.tagName)) {
                        isSubmit = false;
                    }
                });
                if (!isSubmit) {
                    alert("请确认'红字或红框'处的输入正确!");
                    return false;
                }
                if ($("#VacationType").val() == "调休" && $("#ReplacedDay").val() == "") {
                    alert("请输入对应的'值班加班时间'");
                    return false;
                }
                if ($("#VacationType").val() == "调休" && parseFloat($("#DaysCnt").val()) != "1" && parseFloat($("#DaysCnt").val()) != "2") {
                    alert("一次只允许调休1天或2天");
                    return false;
                }
                var re = /^[0-9]+.?[0-9]*$/;
                if ($("#VacationType").val() == "年假" && parseInt($("#DaysCnt").val()) != $("#DaysCnt").val()) {
                    alert("年假休假必须是整数");
                    return false;
                }
                return true;
            });

            $("#VacationType").change(
                function () {
                    if ($(this).val() == "调休") {
                        $("#ReplacedDay").removeAttr("disabled");
                        $("#trExchange").show();
                    } else {
                        $("#ReplacedDay").attr("disabled", "True");
                    }
                });
        });
    </script>
</head>
<body>
<form id="Form1" runat=server><input type=hidden runat=server id=FormId />
<table class="s1">
<tr><td>表单编号</td><td>系统自动生成</td><td>申请时间</td><td><%=DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")%></td></tr>
<tr><td>申请人</td><td><%=ebi.Name%></td><td>请假类型</td>
<td><select id="VacationType" runat="server" title="不能为空" reg=".">
<option value="">请选择</option>
<option value="事假">事假</option>
<option value="病假">病假</option>
<option value="婚假">婚假</option>
<option value="丧假">丧假</option>
<option value="年假">年假</option>
<option value="公假">公假</option>
<option value="调休">调休</option>
<option value="产假">产假</option>
<option value="陪产假">陪产假</option>
<option value="外勤">外勤</option>
</select></td></tr>
<tr>
    <td>已批年假(天)</td><td><label id="lblNianJia" name="lblNianJia" runat="server"></label></td>
    <td>总年假(天)</td><td><label id="lblNianJiaTotal" name="lblNianJiaTotal" runat="server"></label></td>
</tr>
    <tr><td>总天数</td><td><input id="DaysCnt" runat="server" title="整数或带一位小数" reg="^\d+\.?\d?$"/></td><td></td><td></td></tr>
    <tr><td>值班、加班时间</td><td colspan=3><input id="ReplacedDay" runat="server" disabled="True"/></td></tr>
    <tr id="trExchange" name="trExchange" style="display:none;background:#ffff99;">
        <td colspan="2">
            <asp:Repeater ID="rptList" runat="server">
                <HeaderTemplate>
                    <table border="0px" cellpadding="0px" cellspacing="0px">
				    <tr>
					    <th width="30%">休息开始时间</th>
					    <th width="30%">休息结束时间</th>
					    <th>对应加班时间说明</th>
				    </tr>
                </HeaderTemplate>
                <ItemTemplate>
				    <tr>
					    <td><%#Eval("PreStartTime")%></td>
					    <td><%#Eval("PreEndTime")%></td>
					    <td><%# string.IsNullOrWhiteSpace(Eval("Remarks").ToString()) ? "&nbsp;" : Eval("Remarks")%></td>
				    </tr>
                </ItemTemplate>
                <FooterTemplate>
                </table>
                </FooterTemplate>
            </asp:Repeater>
        </td>
        <td colspan="2">
            <table border="0px" cellpadding="0px" cellspacing="0px">
			<tr>
				<th width="30%">加班开始时间</th>
				<th width="30%">加班结束时间</th>
				<th>加班原因</th>
			</tr>
            <asp:Repeater ID="rptList2" runat="server">
            <ItemTemplate>
				<tr>
					<td><%#Eval("PreStartTime")%></td>
					<td><%#Eval("PreEndTime")%></td>
					<td><%# string.IsNullOrWhiteSpace(Eval("Cause").ToString()) ? "&nbsp;" : Eval("Cause")%></td>
				</tr>
            </ItemTemplate>
            </asp:Repeater>
            <asp:Repeater ID="rptList3" runat="server">
            <ItemTemplate>
				<tr>
					<td><%#Eval("dutydate")%></td>
					<td><%#Eval("dutydate")%></td>
					<td>值班</td>
				</tr>
            </ItemTemplate>
            </asp:Repeater>
            </table>
        </td>
    </tr>    
</table>
<div style="text-align:right;margin-right:24px;margin-top:6px;">
    <asp:button runat="server" text="保存" class="btn" id="btnSave" onclick="btnSave_Click"/>
    <input type=button value="关闭" class="btn" onclick="window.close();" />
</div>
</form>
</body>
</html>